import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_statusbar_manager/flutter_statusbar_manager.dart';
import 'package:rms_mobile_client/Bloc/Storage/IDataContext.dart';
import 'package:rms_mobile_client/Bloc/Storage/Json/LocalJsonDataContext.dart';
import 'package:rms_mobile_client/Entities/MyApp.dart';
import 'package:rms_mobile_client/Localizations/Language.dart';
import 'package:rms_mobile_client/Localizations/Localization.dart';
import 'package:rms_mobile_client/StateManagement/ObservableList.dart';
import 'package:rms_mobile_client/UI/Pages/SignInPage.dart';

import 'StateManagement/ModelProvider.dart';

void main() {

  IDataContext dataContext = LocalJsonDataContext();

  runApp(Localization(
    child: Builder(
      builder: (context) => ModelProvider<IDataContext>(
        model: dataContext,
        child: MaterialApp(
          theme: ThemeData(
              fontFamily: Localization.of(context).language.defaultFontName,
              primaryColor: Colors.blue,
              platform: TargetPlatform.iOS
          ),
          home: Builder(
            builder: (context){
              try {
                FlutterStatusbarManager.setColor(Colors.transparent);
                FlutterStatusbarManager.setNavigationBarStyle(NavigationBarStyle.LIGHT);
                FlutterStatusbarManager.setNavigationBarColor(Theme.of(context).primaryColor);
              }
              catch (exception){

              }

              return SignInPage();
            },
          ),
        ),
      ),
    ),
    language: Language.ug,
  ));
}
